package com.dbapp.shopping.data;

import com.dbapp.shopping.domain.Good;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;

public interface GoodRepository
    extends CrudRepository<Good, Long> {

    @Query("select g from Good g where name like :query and display = true")
    List<Good> findByNameLike(String query);

    @Query("select g from Good g where display = true")
    List<Good> findAllGoods();

    void delete(Good good);

}
